var userName = "admin";
var height = $(window).height();
$(".page-content").css("height", height - 55);
window.onresize = function () {
    $(".page-content").css("height", $(window).height() - 55);
};
// $(".page-body iframe").css({"height": $(window).height() - 55});

$("#nav_menu").nav("resources/admin/data/nav.json");

$("#logout").click(function () {
    window.location.href = "/Admin/user/toLoginPage";
});

$("#refresh-toggler").click(function () {
    if ($(".page-body iframe")[0]) {
        $(".page-body iframe")[0].contentWindow.location.reload()
    }
});

$("#updatePwd").click(function () {
    var dialog = $.showDialog({
        title: '修改密码',
        url: "template/common/password.html",
        width: 500,
        height: 250,
        btn: ['确定'],
        events: {
            yes: function () {
                var body = layer.getChildFrame('body', dialog);
                var password = body.find("#password").val();
                if (password == null || password == "") return layer.msg("密码不能为空!");
                if (password.length < 6) return layer.msg("密码长度不能小于6");
                $.getScript('resources/admin/extra/js/md5.js').done(function () {
                    password = hex_md5(password);
                    alert(password);
                    var loading = $.openLoading();
                    //$put("/Admin/adminUser/password", {password: password}, function (res) {
                    //    closeLoading(loading);
                    //    if (res.code == 100) {
                    //        layer.msg("密码修改成功，请重新登录");
                    //        setTimeout(function () {
                    //            window.location.href = "/Admin/user/toLoginPage";
                    //        }, 500);
                    //    }
                    //});
                    setTimeout(function () {
                        $.closeAll();
                    }, 1000);
                });
            }
        }
    });
});